今天來介紹 Git 的其他基本功能:
git log
commit 888cee9cbe44dea043b4440c40717db716cfa0f6 (HEAD -> master)
Author: <rock@wangjiajide-MacBook-Air.local>
Date: Mon Jun 15 20:51:04 2020 +0800
first commit
可以看到:
888cee9cbe44dea043b4440c40717db716cfa0f6
first
git log --oneline
簡短顯示歷史888cee9 (HEAD -> master) first commit
(END)
git diff
diff --git a/rock.txt b/rock.txt
index 4e1053c..062e147 100644
--- a/rock.txt
+++ b/rock.txt
@@ -1 +1 @@
-Code6
+Code4
(END)
可以看到這次做了什麼修改:新增了 b 目錄下的 rock.txt
檔案,刪除了 a 目錄下的 rock.txt
檔案。
commit 2d4ef193227d567d3c7df70c0721b8323a0e161c (HEAD -> master)
Author: <rock@wangjiajide-MacBook-Air.local>
Date: Mon Jun 15 21:28:32 2020 +0800
third commit
commit 1f9d406a9ea3665f5a36eb949cfead3e3e7640c0
Author: <rock@wangjiajide-MacBook-Air.local>
Date: Mon Jun 15 21:27:53 2020 +0800
second commit
commit 888cee9cbe44dea043b4440c40717db716cfa0f6
Author: <rock@wangjiajide-MacBook-Air.local>
Date: Mon Jun 15 20:51:04 2020 +0800
first commit
(END)
git checkout 1f9d406a9ea3665f5a36eb949cfead3e3e7640c0
commit 1f9d406a9ea3665f5a36eb949cfead3e3e7640c0 (HEAD)
Author: <rock@wangjiajide-MacBook-Air.local>
Date: Mon Jun 15 21:27:53 2020 +0800
second commit
commit 888cee9cbe44dea043b4440c40717db716cfa0f6
Author: <rock@wangjiajide-MacBook-Air.local>
Date: Mon Jun 15 20:51:04 2020 +0800
first commit
(END)
是不是回到第二次的時間了!
git checkout master
就會回到最新的版本時間上了!
使用的順序:
touch .gitignore
vim .gitignore
rock.txt
//在vim編輯器裡面輸入檔名,例如:rock.txt